package br.com.tas;

import java.util.List;

import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import br.com.tas.model.CoordinatesBean;

import com.example.tas.R;

public class CoordinatesAdapter extends BaseAdapter{

	private List<CoordinatesBean> coordinatesBeans;
	private Context context;
	
	ListView lv;
	
	public CoordinatesAdapter(List<CoordinatesBean> coordinatesBeans,
			Context context) {
		this.coordinatesBeans = coordinatesBeans;
		this.context = context;
	}

	public CoordinatesAdapter(OnClickListener onClickListener) {
		// TODO Auto-generated constructor stub
	}

	@Override
	public int getCount() {
		return coordinatesBeans.size();
	}

	@Override
	public Object getItem(int i) {
		return coordinatesBeans.get(i);
	}

	@Override
	public long getItemId(int i) {
		return i;
	}


	@Override
	public View getView(int i, View v, ViewGroup vg) {
		CoordinatesBean coordinatesBean = coordinatesBeans.get(i);
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view = inflater.inflate(R.layout.item_list_address, null);
		
		TextView txtProfileName = (TextView) view.findViewById(R.id.txtProfileName);
		txtProfileName.setText(coordinatesBean.getProfile());
		
		TextView txtAddress = (TextView) view.findViewById(R.id.txtAddressDetails);
		txtAddress.setText(coordinatesBean.getAddress());
		
		return view;
	}
}
